<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head> 
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
    <%-- <script src="${ctxStatic}/jquery/jquery-1.9.1.min.js"></script> --%>
   <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <script>
	$(function(){
		
		getNotOutboundNum();
		searchListForm();
        $(".tabBox ul li").each(function(){
            var index=$(this).index();

            $(".tabBox ul li").eq(0).addClass("active");

            $(this).click(function(){

                $(this).addClass("active").siblings().removeClass("active");
                
                $("#tabPageStatus").val($(this).val());
                searchListForm();

                $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
				
				var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
				if(tabodyH>tableScrollH){
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
				}else{
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
				}

            })

        })

    });
	
	// 检索方法
	function searchListForm() {
		var params = $("#searchForm").serialize();
		$("#activity_pane").showLoading();
		$.post("${ctx}/inventory/requestex/searchList",params,function(result) {
					var listHtml = result["inventoryRequestEx"];
					var pageHtml = result["page"];
					$("#listHtml").html(listHtml);
					$("#paging").html(pageHtml);
					$("#activity_pane").hideLoading();
				}, 'json');
	}
	
	// 重置方法
	function clearParam() {
		$("#inventoryRequestNo").val("");
		$("#productionNo").val("");
		$("#indentNo").val("");
		$("#dateFrom").val("");
		$("#dateTo").val("");
		searchListForm();
		getNotOutboundNum();
	}
	
    $(document).keydown(function(event){
    	if(event.keyCode == 13){
    		searchListForm();
    	}
    }); 
    
  //每隔一分钟刷新一次
    function getNotOutboundNum(){ 
    	var url = "${ctx}/inventory/requestex/getNotOutboundNum";
    	$.post(url,"",function(result){
    		if (result == 0) {
    			$("#updateNum").parent().addClass("none");
			}else{
				$("#updateNum").parent().removeClass("none");
				$("#updateNum").html(result);
			}
		},'json');
    } 
    //重复执行某个方法 
    window.setInterval("getNotOutboundNum()",30000); 
    //去掉定时器的方法 
    //window.clearInterval(t2); 
    
    </script>
</head>
<body>
<form id="searchForm" method="post">
<div class="listArea" id="activity_pane">
	<div class="listBg">
        <div class="searchArea clearfix">
            <div class="searchLeft clearfix" style="width: 1000px;">
                <div class="searchInp clearfix">
                    <!-- 出库单号 -->
                    <p><spring:message code="inventory_requestex_list_search_inventoryRequestNo" /></p>
                    <input type="text" class="w-styleNub" id="inventoryRequestNo" name="inventoryRequestNo">
                </div>
                <div class="searchInp clearfix">
                    <!-- 生产制单号 -->
                    <p><spring:message code="inventory_requestex_list_search_productionNo" /></p>
                    <input type="text" class="w-styleNub" id="productionNo" name="productionNo">
                </div>
                <div class="searchInp clearfix">
                    <!-- 客户订单号 -->
                    <p><spring:message code="inventory_requestex_list_search_indentNo" /></p>
                    <input type="text" class="w-styleNub" id="indentNo" name="indentNo">
                </div>
                <div class="searchInp clearfix">
                    <!-- 日期 -->
                    <p><spring:message code="inventory_requestex_list_search_date" /></p>
                    <div class="timeBox">
                        <input type="text" class="laydate-icon" id="dateFrom" name="dateFrom" style="width: 110px" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})">
						<p class="list">~</p>
						<input type="text" class="laydate-icon" id="dateTo" name="dateTo" style="width: 110px" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})">
                    </div>        
                </div>
            </div>
            <div class="searchRight clearfix">
            	<!-- 入出库导入 -->
		        <button type="button" class="btn-js"  onclick="popup('500px','150px','${ctx}/material/stock/uploadExcel');"><spring:message code="material_inoutboundImport"/></button>
                <button type="button" onclick="searchListForm();"><spring:message code="commom_check"/></button>
                <button type="button" onclick="clearParam();"><spring:message code="common_reset" /></button>
                <shiro:hasPermission name="inventory:request:edit">
                <button type="button" onclick="popup('900px','584px','${ctx}/inventory/requestex/form')"><spring:message code="common_create" /></button>
                </shiro:hasPermission>
            </div>
        </div>
    </div>
    <input type="hidden" id="tabPageStatus" name="tabPageStatus" value="0"/>
    <div class="tabBox">
        <ul class="clearfix">
            <!-- 全部 -->
            <li class="active" value="0"><spring:message code="inventory_requestex_list_tab_all"/></li>
            <!-- 待入库 -->
            <li value="1"><spring:message code="inventory_requestex_list_tab_wait" /><div class="UnreadReminding none"><span id="updateNum">0</span></div></li>
            <!-- 已入库 -->
            <li value="2"><spring:message code="inventory_requestex_list_tab_done" /></li>
        </ul>
	</div>
   <div class="listBg tabPadding overflowX">
        <div class="tableArea tabBoxSm">
            <div class="tableScrollSm" style = "height:650px;overflow: auto;width: 1033px;">
                <table cellpadding="0" class="tableHead" >
                    <thead>
                    <tr>
                        <!-- No. -->
                        <th><p class="table-No"><spring:message code="inventory_requestex_list_no"/></p></th>
                        <!-- 出库单号 -->
                        <th><p class="width-150px"><spring:message code="inventory_requestex_list_requestNo" /></p></th>
                        <!-- 客户名称 -->
                        <th><p class="width-125px"><spring:message code="inventory_requestex_list_venderName"/></p></th>
                        <!-- 客户订单-->
                        <th><p class="width-180px"><spring:message code="inventory_requestex_list_indentNo" /></p></th>
                        <!-- 出库状态 -->
                        <th><p class="width-100px"><spring:message code="inventory_requestex_list_iventoryStatus" /></p></th>
                        <!-- 经办人员 -->
                        <th><p class="width-100px"><spring:message code="inventory_requestex_list_handleUser" /></p></th>
                        <!-- 经办日期 -->
                        <th><p class="width-100px"><spring:message code="inventory_requestex_list_handleDate" /></p></th>
                        <!-- 申请人员 -->
                        <th><p class="width-100px"><spring:message code="inventory_requestex_list_requestUser"/></p></th>
                        <!-- 申请日期 -->
                        <th><p class="width-100px"><spring:message code="inventory_requestex_list_requestDate"/></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody">
					<tbody id="listHtml">
					</tbody>
                </table>
            </div>
        </div>
    </div>
    <div id="paging"></div>
    </div>
</form>
</body>
</html>